YAML file as Configuration Property In Mule
As part of this tutorial we will demonstrate how can we use YAML file to define property in hierarchical manner and consume the property from inside the dataweave or mule configuration. Also, we will show how we can define secure property as YAML and refer the secure property from another YAML file
Create a sample project in Anypoint studio
Create a folder(optional) to define the YAML as property file

Define the properties inside dev.yaml file, you can also see how we refer the secure property from secure-dev.yaml(defined below) inside dev.yaml

dev.yaml
https:
listener:
host: "0.0.0.0"
keystore:
file: "ssl/server-keystore-dev.p12"
alias: "server"
password: "${secure::keystore.password}"
truststore:
file: "ssl/client-truststore.p12"
alias: "localhost-client"
password: "${secure::truststore.password}"
timeout:
connection-idle: "600000"
private:
port: "8092"
port: "8082"
request:
timeout:
connection-idle: "500000"
response: "40000"
Define Secure properties

secure-dev.yaml
keystore: password: "![kiwQK955ycpgW9LT1kzXzA==]" truststore: password: "![kiwQK955ycpgW9LT1kzXzA==]"
Drag and drop listener configuration and configure the property using yaml file

In a similar way configure the property for TLS that also includes secure property

To use configuration file and secure configuration file we need to define this as part of Global Elements, we can see the Secure properties Config below

YAML property path

Secure YAML property path

Mule Key is required to encrypt and decrypt the property

Retrieve the property inside dataweave from YAML file

Sample Dataweave Expression:
%dw 2.0
output application/java
---
p('https.listener.host') ++ ":" ++ p('https.port')
Sample Project: Sample mule application
what are the !, [, and ] symbols in the password used for?